package com.bristua.mall.wx.controller;

import com.bristua.mall.common.bean.Result;
import com.bristua.mall.wx.biz.WxAppPayBiz;
import com.bristua.mall.wx.enums.WxPayCode;
import com.bristua.mall.wx.model.condition.WXAppPayOrderParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Administrator on 2019/4/19.
 */
@RestController
public class AppWxPayController {

    @Autowired
    private WxAppPayBiz wxAppPayBiz;

    @PostMapping(value="/api/wx/app/pay")
    public Result appWxPay(@RequestBody WXAppPayOrderParams wxAppPayOrderParams){
        Result result = new Result();
        result.setCode(WxPayCode.WX_APP_SEND_ORDER_SUCCESS.getCode());
        result.setMsg(WxPayCode.WX_APP_SEND_ORDER_SUCCESS.getMsg());
        result.setData(wxAppPayBiz.wxAppPay(wxAppPayOrderParams));
        return result;
    }
}
